home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 1 / Amiga Tools.iso / egs-tools / egs_dev-disk / egsincludes / egsintuigfx.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-06  |  25.5 KB  |  700 lines

  1. #ifndef EGS_EGSINTUIGFX_H
  2. #define EGS_EGSINTUIGFX_H
  3.  
  4. /***************************************************************************\
  5. *
  6. *  $
  7. *  $ FILE     : egsintuigfx.h
  8. *  $ VERSION  : 1
  9. *  $ REVISION : 5
  10. *  $ DATE     : 08-Dec-93 12:45
  11. *  $
  12. *  $ Author   : mvk
  13. *  $
  14. *
  15. *****************************************************************************
  16. *                                                                           *
  17. * (c) Copyright 1990/94 VIONA Development                                   *
  18. *     All Rights Reserved                                                   *
  19. *                                                                           *
  20. \***************************************************************************/
  21.  
  22. #ifndef         EGS_EGSGFX_H
  23. #include        <egs/egsgfx.h>
  24. #endif
  25.  
  26. /*
  27.  * To make rendering of graphics in windows, menus and gadgets as flexible,
  28.  * efficient and powerful as possible, the ESGIntui library has an inter-
  29.  * preter that executes programs of a simple stack graphics language.
  30.  *
  31.  * Programs in this language are used for all EGSIntui graphics such as
  32.  * gadgets, menus and "requesters". As the language knows subroutines with
  33.  * parameters, this technique is much more flexible than the known one
  34.  * with separate border, text and image lists.
  35.  *
  36.  *  Examples:
  37.  *
  38.  *   - If you need similar shadowed text for requesters or menus you need to
  39.  *     define only one such procedure. Then you call it each time you need
  40.  *     that text with the string as parameter.
  41.  *
  42.  *   - For gadgets with three-dimensional borders it is sufficient to program
  43.  *     that border only once since the EGSIntui library passes over the
  44.  *     position and size for the .select and .release graphics of requesters
  45.  *     and menus.
  46.  *
  47.  *   - If you need the same element for some graphics, e.g. color selection
  48.  *     requesters, these can be rendered by a program loop.
  49.  *
  50.  *   - Frequently used graphics elements can be collected in a module and be
  51.  *     reused again and again.
  52.  *
  53.  *   - As you have access to the standard colors of a window (screen) from
  54.  *     inside an IntuiGfx program, the same requesters can be used for
  55.  *     different bit depths and color palettes without change.
  56.  *
  57.  *   - As gadgets or menue elements may vary in size, according to the used
  58.  *     font and/or language, functions for rescalable images are supported.
  59.  *
  60.  */
  61.  
  62.  
  63.  
  64. /*
  65.  * WinColors
  66.  *
  67.  * To give requesters etc. an optimal coloring even for different bit depths,
  68.  * for each screen (or window) a structure is defined that contains the usual
  69.  * colors with their values.  These colors can be accessed from IntuiGfx
  70.  * programs.  Moreover, the colors are used in (string) gadgets.
  71.  *
  72.  * .Light     : A light color for 3D structures.
  73.  * .Normal    : The color of a non-selected object.
  74.  * .Dark      : A dark color for shadow effects.
  75.  * .Select    : The color of a selected object.
  76.  * .Back      : A window's background color.
  77.  * .TxtFront  : Colour for text.
  78.  * .TxtBack   : Background color for text.
  79.  */
  80.  
  81. typedef struct IG_WinColors *IG_WinColorsPtr;
  82.  
  83. struct IG_WinColors {
  84.     LONG Light, Normal, Dark, Select, Back, TxtFront, TxtBack;
  85. };
  86.  
  87.  
  88.  
  89. /*
  90.  * An IntuiGfx program consists of an array of long words containing con-
  91.  * stants, addresses or commands. Commands and constants differ from addresses
  92.  * in that their highest bit is set (even Commodore uses this high-bit so
  93.  * that no compatibility problems should occur).  The end of a program is
  94.  * specified by the special command "RTS" or "RTF+...".
  95.  *
  96.  * The language is stack oriented, i.e. commands and procedures always refer
  97.  * to parameters pushed onto the stack.  Besides the stack pointer (SP) there
  98.  * exists a frame pointer (FP) that addresses parameters and local variables.
  99.  * By the command "FRAME" this variable range can be increased.
  100.  *
  101.  * For many commands needing constant data that data is simply added to the
  102.  * command token.
  103.  *
  104.  * The stack works with predecrement (PUSH) and postincrement (POP) so that
  105.  * older elements are addressed with positive displacements.
  106.  *
  107.  * All commands returning a value pass it on the stack, likewise all commands
  108.  * and procedures expect their parameters on the stack and deallocate them
  109.  * automatically.
  110.  *
  111.  * All graphics coordinates in an IntuiGfx program regard the graphics cursor
  112.  * position at the beginning of the procedure as origin.  The interpreter
  113.  * can be invoked with parameters that are passed on the stack as usual.
  114.  * EGSIntui does this too, e.g. for .active and .release calls for gadgets
  115.  * and menus.
  116.  *
  117.  * The normal parameters for intui structures as gadgets or menues is
  118.  * (width, height).
  119.  *
  120.  *###########################################################################
  121.  *
  122.  * Command overview:
  123.  *
  124.  *
  125.  * (1). Stack and frame specific commands
  126.  *
  127.  *
  128.  *  POP   : Removes the topmost stack element.
  129.  *          INC(SP)
  130.  *
  131.  *  POPN  : Removes the number of stack element as specified by SP[0].
  132.  *          INC(SP,SP[0]+1)
  133.  *
  134.  *  DUP   : Duplicates the topmost stack element.
  135.  *          SP-^:=SP[0]
  136.  *
  137.  *  DUPN  : Duplicates as many elements as specified by SP[0].
  138.  *          x:=SP+^;SP-^:=SP[0..x]
  139.  *
  140.  *  DUPI  : Duplicates as many elements as specified by DUPI.
  141.  *          x:='DUPI';SP-^:=SP[0..x]
  142.  *
  143.  *  SWAP  : Swaps the two topmost stack elements.
  144.  *          PS[1] <-> SP[0];
  145.  *
  146.  *  ROT3  : Rotates the topmost three elements.
  147.  *          SP[2] -> SP[0] -> SP[1] -> SP[2]
  148.  *
  149.  *  ROTN  : Rotates as many elements as specified by SP[0].
  150.  *          x:=SP+^;SP[x] -> SP[0] -> SP[1] -...-> SP[x]
  151.  *
  152.  *  BYTE  : Reads a byte from the memory address SP^.
  153.  *          SP[0]:=BytePtr(SP[0])^
  154.  *
  155.  *  VAL   : Reads a word from the memory address SP^.
  156.  *          SP[0]:=IntPtr(SP[0])^
  157.  *
  158.  *  ADR   : Reads a long word from the memory address SP^.
  159.  *          SP[0]:=LongPtr(SP[0])^
  160.  *
  161.  * There are also POKE commands for byte, word and long (see below) !
  162.  *
  163.  *  GET1  : Gets the second stack element.
  164.  *          SP-^:=SP[1]
  165.  *
  166.  *  GET2  : Gets the third stack element.
  167.  *          SP-^:=SP[2]
  168.  *
  169.  *  GETN  : Gets the SP[0]'th stack element.
  170.  *          SP[0]:=SP[SP[0]+1]
  171.  *
  172.  *  GETSI : Gets the stack element specified by GETSI.
  173.  *          SP-^:=SP['GETSI']
  174.  *
  175.  *  GETF  : Gets the SP[0]'th stack element.
  176.  *          SP[0]:=FP[SP[0]]
  177.  *
  178.  *  GETFI : Get the frame element specified by GETFI.
  179.  *          SP-^:=FP['GETFI']
  180.  *
  181.  *  PUTF  : Writes SP[1] to the frame element specified by SP[0].
  182.  *          FP[SP[0]]:=SP[1];INC(SP,2)
  183.  *
  184.  *  PUTFI : Writes SP[0] to the frame element specified by PUTFI.
  185.  *          FP['PUTFI']:=SP[0];INC(SP)
  186.  *
  187.  *  Const : Pushes a constant onto the stack.
  188.  *          SP-^:='Const'
  189.  *
  190.  *  Const24:Pushes the constant in Const24 shifted left by eight bits onto
  191.  *          the stack (for 24 bit colors).
  192.  *          SP-^:='Const24' SHL 8
  193.  *
  194.  *  STKADR: Pushes the actual value of the stackpointer onto the stack.
  195.  *          SP-^:=SP;
  196.  *
  197.  * (2). Arithmetic and logic commands
  198.  *
  199.  *
  200.  *  ADD   : Adds the two topmost stack elements.
  201.  *          SP[1]:=SP[1]+SP[0];INC(SP)
  202.  *
  203.  *  ADDI  : Adds the ADDI constant to SP[0].
  204.  *          SP[0]:=SP[0]+'ADDI'
  205.  *
  206.  *  SUB   : Subtracts the first stack element from the second.
  207.  *          SP[1]:=SP[1]-SP[0];INC(SP)
  208.  *
  209.  *  NEG   : Negates the topmost stack element.
  210.  *          SP[0]:=-SP[0]
  211.  *
  212.  *  MUL   : Multiplies the two topmost stack elements.
  213.  *          SP[1]:=SP[1]*SP[0];INC(SP)
  214.  *
  215.  *  IDIV  : Divides the second stack element by the first.
  216.  *          SP[1]:=SP[1]/SP[0];INC(SP)
  217.  *
  218.  *  IMOD  : Divides the second stack element by the first and yields the
  219.  *          modulus of the operation.
  220.  *          SP[1]:=SP[1] mod SP[0];INC(SP)
  221.  *
  222.  *  SEQ   : Tests if SP[1] is equal to SP[0]; result -1 if true, else 0.
  223.  *          IF SP[1]=SP[0] THEN SP[1]:=-1 ELSE SP[1]:=0 END;INC(SP)
  224.  *
  225.  *  SNE   : Tests if SP[1] not equal to SP[0]; result -1 if true, else 0.
  226.  *          IF SP[1]#SP[0] THEN SP[1]:=-1 ELSE SP[1]:=0 END;INC(SP)
  227.  *
  228.  *  SGT   : Tests if SP[1] greater than SP[0]; result -1 if true, else 0.
  229.  *          IF SP[1]>SP[0] THEN SP[1]:=-1 ELSE SP[1]:=0 END;INC(SP)
  230.  *
  231.  *  SLT   : Tests if SP[1] less than SP[0].
  232.  *          IF SP[1]<SP[0] THEN SP[1]:=-1 ELSE SP[1]:=0 END;INC(SP)
  233.  *
  234.  *  SGE   : Tests if SP[1] greater or equal to SP[0].
  235.  *          IF SP[1]>=SP[0] THEN SP[1]:=-1 ELSE SP[1]:=0 END;INC(SP)
  236.  *
  237.  *  SLE   : Tests if SP[1] less or equal to SP[0].
  238.  *          IF SP[1]<=SP[0] THEN SP[1]:=-1 ELSE SP[1]:=0 END;INC(SP)
  239.  *
  240.  *  SNOT  : Result 0 if SP[0] not zero, else -1.
  241.  *          IF SP[0]=0 THEN SP[0]:=-1 ELSE SP[0]:=0 END;
  242.  *
  243.  *  SAND  : Result -1 if SP[0] and SP[1] are both not zero, else 0.
  244.  *          IF SP[0]#0 AND SP[1]#0 THEN SP[1]:=-1 ELSE SP[1]:=0 END;INC(SP)
  245.  *
  246.  *  SOR   : Result -1 if SP[0] or SP[1] is not zero, else 0.
  247.  *          IF SP[0]#0 OR SP[1]#0 THEN SP[1]:=-1 ELSE SP[1]:=0 END;INC(SP)
  248.  *
  249.  *
  250.  * (3). Program control commands
  251.  *
  252.  *
  253.  *  JMP   : Jumps to the address SP[0].
  254.  *          PC:=SP[0];INC(SP)
  255.  *
  256.  *  RTS   : Return from a subroutine without frame deallocation.
  257.  *          POP(PC)
  258.  *
  259.  *  RTF   : Return form a subroutine with frame deallocation.
  260.  *          SP:=FP+'RTF';POP(PC)
  261.  *
  262.  *  JSR   : Calls a subroutine at the specified location.
  263.  *          PUSH(PC);PC:=SP[0];INC(SP)
  264.  *
  265.  *  While S1 Do S2 End : Executes program segments S1 and S2 as long as after
  266.  *                       S1 a value not equal to zero 0 is on the stack.
  267.  *                       Then that value is deallocated.
  268.  *
  269.  *  If S1 Else S2 End  : Executes S1 if for "If" a value not equal to zero
  270.  *                       is on the stack, else S2 is executed.  Then that
  271.  *                       value is deallocated.
  272.  *
  273.  *  Repeat S1 Until    : Executes S1 until then a value not equal to zero is
  274.  *                       on the stack.  Then that value is deallocated.
  275.  *
  276.  *
  277.  * (4). Graphics commands
  278.  *
  279.  *
  280.  *  Color : Sets the current color to the value in SP[0].
  281.  *          SetAPen(r,SP[0]);INC(SP)
  282.  *
  283.  *  Back  : Sets the background color to the value in SP[0].
  284.  *          SetBPen(r,SP[0]);INC(SP)
  285.  *
  286.  *  ModeA : Sets drawing mode "drawAPen".
  287.  *          SetDrMd(r,drawAPen)
  288.  *
  289.  *  ModeAB: Sets drawing mode "drawABPen".
  290.  *          SetDrMd(r,drawABPen)
  291.  *
  292.  *  ModeInvers: Sets drawing mode "invert".
  293.  *          SetDrMd(r,invert)
  294.  *
  295.  *  Image : Copies the contents of a BitMap specified by SP[0] to the
  296.  *          current cursor position.
  297.  *          map:=BitMapPtr(SP[0]);INC(SP);
  298.  *          CopyBitMapRastPort(map,r,0,0,map.^width,map.^height,r^.cx,r^.cy);
  299.  *
  300.  *  Packed: Unpacks an image from bit plane form and copies it to the current
  301.  *          cursor position.
  302.  *
  303.  *          image:=ImagePtr(SP[0]);col:=ColorTablePtr(SP[1]);INC(SP,2);
  304.  *          IF UnpackImage(map,image^,r^.depth,col^) THEN
  305.  *            CopyBitMapRastPort(map'PTR,r,0,0,map.width,map.height...
  306.  *            DisposeBitMap(map)
  307.  *          END
  308.  *
  309.  *  Move  : Moves the graphics cursor by the distance in (SP[1],SP[0]).
  310.  *          INC(r^.cx,SP[1]);INC(r^.cy,SP[0]);INC(SP,2)
  311.  *
  312.  *  Locate: Sets the cursor to the position (SP[1],SP[0]).
  313.  *          Move(r,SP[1],SP[0]);INC(SP,2)
  314.  *
  315.  *  Locate00: Resets the cursor to the origion.
  316.  *            Move(r,0,0)
  317.  *
  318.  *  Draw  : Draws a line by (SP[1],SP[0]) relative from the cursor position.
  319.  *          Draw(r,r^.cx+SP[1],r^.cy+SP[0]);INC(SP,2);
  320.  *
  321.  *  DrawAbs:Draws a line from the cursor to the point (SP[1],SP[0]).
  322.  *          Draw(r,SP[1],SP[0]);INC(SP,2)
  323.  *
  324.  *  Box   : Draws a filled rectangle with width SP[1] and height SP[0].
  325.  *          RectangleFill(r,r^.cx,r^.cy,SP[1],SP[0]);INC(SP,2)
  326.  *
  327.  *  Box2d : Draws a rectangular border width width SP[1] and height SP[0].
  328.  *            Draw(rast,r.cx+SP[1]-1,r.cy);
  329.  *            Draw(rast,r.cx,r.cy+SP[0]-1);
  330.  *            Draw(rast,r.cx-SP[1]+1,r.cy);
  331.  *            Draw(rast,r.cx,r.cy-SP[0]+1);
  332.  *            DEC(SP,2);
  333.  *
  334.  *  Box3d : Draws a pseudo three dimensional rectangular border.
  335.  *          width SP[1], height SP[0], top left color SP[2] and bottom
  336.  *          right color SP[3];
  337.  *
  338.  *  Rect3d: Draws a pseudo three dimensional filled rectangular border.
  339.  *          width SP[1], height SP[0], top left color SP[2] and bottom
  340.  *          right color SP[3], interiour color SP[4];
  341.  *
  342.  *  Write : Writes text to the current cursor position.  SP[0] is the string
  343.  *          pointer.  The first byte contains the string length, followed
  344.  *          by the string characters.  ATTENTION:  This is a Cluster string !
  345.  *          Text(r,SP[0]^.data'PTR,SP[0]^.len);INC(SP)
  346.  *
  347.  *  Text  : Writes text to the current cursor position aus.  SP[0] is the
  348.  *          string pointer to a null-terminated string.  This procedure
  349.  *          should be used by C programmers.
  350.  *          Text(r,SP[0],Length(SP[0]^));
  351.  *
  352.  *  Font  : Sets an EFont given by SP[0].  SP[0] is the pointer to an opened
  353.  *          EFont.
  354.  *          r^.font:=EFontPtr(SP[0]);INC(SP)
  355.  *
  356.  *
  357.  *
  358.  * (5). Graphics functions
  359.  *
  360.  *
  361.  *  GetPosX: Gets the current cursor X coordinate.
  362.  *           INC(SP);SP[0]:=r^.cx
  363.  *
  364.  *  GetPosY: Gets the current cursor Y coordinate.
  365.  *           INC(SP);SP[0]:=r^.cy;
  366.  *
  367.  *  GetColor: Gets the current drawing color.
  368.  *            INC(SP);SP[0]:=r^.aPen
  369.  *
  370.  *  GetBack : Gets the current background color.
  371.  *            INC(SP);SP[0]:=r^.bPen
  372.  *
  373.  *  CLight    : Gets the light window color.
  374.  *  CNormal   : Gets the normale window border color.
  375.  *  CDark     : Gets the dark window color.
  376.  *  CSelect   : Gets the "selected" window color.
  377.  *  CBack     : Gets the window background color.
  378.  *  CTxtFront : Gets the recommended window text front color.
  379.  *  CTxtBack  : Gets the recommenden window text background color.
  380.  *
  381.  *  If you need more colors like Gadget Drak a.s.o use the ColorTags
  382.  *  form the egsintui.h as a egsintugfx command to get the color.
  383.  *
  384.  *  CTAGs     : Gets the value of a window color. The value of the command
  385.  *              is the same as that of the tag.
  386.  *
  387.  *
  388.  * (6). Scaled functions
  389.  *
  390.  *  All scaled command work in a fixed coordinate space [0..4095]x[0..4095].
  391.  *  This coordinate space is translated to a selected rectangular area that
  392.  *  is specified by 'SetScale'.
  393.  *
  394.  *  SetScale  : Sets the rectangular area in which to work, width in SP[1]
  395.  *              and height in SP[0].
  396.  *  SetRatio  : Forces a ratio of SP[1]/SP[0], and changes the drawing
  397.  *              coordinates to fit inside the original area.
  398.  *
  399.  *  SMove     : Moves the graphiccursor by SP[1]/SP[0].
  400.  *  SLocate   : Moves the graphiccursor to SP[1]/SP[0].
  401.  *  SDraw     : Draws a line by SP[1]/SP[0].
  402.  *  SDrawAbs  : Draws a line to SP[1]/SP[0].
  403.  *  SCurve    : Draws a curve with SP[5]/SP[4] and SP[3]/SP[2] by SP[1]/SP[0]
  404.  *  SCurveAbs : Draws a curve with SP[5]/SP[4] and SP[3]/SP[2] to SP[1]/SP[0]
  405.  *  SEllipse  : Draws an ellipse with SP[1] as half the width, and
  406.  *              SP[0] as half the height. Drawn around the cursor.
  407.  *
  408.  *  SAMove    : Moves the graphiccursor by SP[1]/SP[0].
  409.  *  SALocate  : Moves the graphiccursor to SP[1]/SP[0].
  410.  *  SADraw    : Adds an edge to a polygon by SP[1]/SP[0].
  411.  *  SADrawAbs : Adds an edge to a polygon to SP[1]/SP[0].
  412.  *  SACurve   : Adds a curve to a filled object with SP[5]/SP[4] and
  413.  *              SP[3]/SP[2] by SP[1]/SP[0]
  414.  *  SACurveAbs: Adds a curve to a filled object with SP[5]/SP[4] and
  415.  *              SP[3]/SP[2] to SP[1]/SP[0]
  416.  *  SAEllipse : Draws a filled ellipse with SP[1] as half the width, and
  417.  *              SP[0] as half the height. Drawn around the cursor.
  418.  *  SAEnd     : Closes the current area-polygon and fills it.
  419.  *
  420.  */
  421.  
  422.  
  423. #define IG_JMP       0x80000001
  424. #define IG_RTS       0x80000002
  425. #define IG_JSR       0x80000003
  426. #define IG_CALL      0x80000004
  427. #define IG_POP       0x80000011
  428. #define IG_DUP       0x80000012
  429. #define IG_SWAP      0x80000013
  430. #define IG_ROT3      0x80000014
  431. #define IG_ROTN      0x80000015
  432. #define IG_BYTE      0x80000111
  433. #define IG_VAL       0x80000016
  434. #define IG_ADR       0x80000017
  435. #define IG_GET1      0x80000018
  436. #define IG_GET2      0x80000019
  437. #define IG_GETN      0x8000001A
  438. #define IG_POPN      0x8000001B
  439. #define IG_DUPN      0x8000001C
  440. #define IG_GETF      0x8000001D
  441. #define IG_PUTF      0x8000001E
  442. #define IG_STKADR    0x8000001F
  443. #define IG_POKEB     0x80000113
  444. #define IG_POKEW     0x80000114
  445. #define IG_POKE      0x80000115
  446. #define IG_ADD       0x80000021
  447. #define IG_NEG       0x80000022
  448. #define IG_SUB       0x80000023
  449. #define IG_MUL       0x80000024
  450. #define IG_IDIV      0x8000002E
  451. #define IG_IMOD      0x8000002F
  452. #define IG_SEQ       0x80000025
  453. #define IG_SNE       0x80000026
  454. #define IG_SGT       0x80000027
  455. #define IG_SLT       0x80000028
  456. #define IG_SGE       0x80000029
  457. #define IG_SLE       0x8000002A
  458. #define IG_SNOT      0x8000002B
  459. #define IG_SAND      0x8000002C
  460. #define IG_SOR       0x8000002D
  461. #define IG_GetPosX   0x80000031
  462. #define IG_GetPosY   0x80000032
  463. #define IG_GetColor  0x80000033
  464. #define IG_GetBack   0x80000034
  465. #define IG_Color     0x80000041
  466. #define IG_Back      0x80000042
  467. #define IG_ModeA     0x80000043
  468. #define IG_ModeAB    0x80000044
  469. #define IG_ModeInvers 0x80000112
  470. #define IG_Image     0x80000045
  471. #define IG_Move      0x80000046
  472. #define IG_Draw      0x80000047
  473. #define IG_Write     0x80000048
  474. #define IG_Text      0x8000004F
  475. #define IG_Box       0x80000049
  476. #define IG_Locate    0x8000004A
  477. #define IG_Locate00  0x8000004B
  478. #define IG_Packed    0x8000004C
  479. #define IG_Font      0x8000004D
  480. #define IG_DrawAbs   0x8000004E
  481. #define IG_Box3d     0x80000401
  482. #define IG_Rect3d    0x80000402
  483. #define IG_Box2d     0x80000403
  484. #define IG_CLight    0x80000050
  485. #define IG_CNormal   0x80000051
  486. #define IG_CDark     0x80000052
  487. #define IG_CSelect   0x80000053
  488. #define IG_CBack     0x80000054
  489. #define IG_CTxtFront 0x80000055
  490. #define IG_CTxtBack  0x80000056
  491. #define IG_While     0x80000101
  492. #define IG_Do        0x80000102
  493. #define IG_If        0x80000103
  494. #define IG_Else      0x80000104
  495. #define IG_End       0x80000105
  496. #define IG_Repeat    0x80000106
  497. #define IG_Until     0x80000107
  498. #define IG_Debug     0x80000200
  499. #define IG_Const     0x81008000
  500. #define IG_Const24   0x89000000
  501. #define IG_GETFI     0x82000000
  502. #define IG_PUTFI     0x83000000
  503. #define IG_GETSI     0x84000000
  504. #define IG_FRAME     0x85000000
  505. #define IG_RTF       0x86000000
  506. #define IG_ADDI      0x87008000
  507. #define IG_DUPI      0x88000000
  508. #define IG_POPI      0x8A000000
  509. #define IG_SetScale  0x80000300
  510. #define IG_SetRatio  0x80000301
  511. #define IG_SMove     0x80000311
  512. #define IG_SLocate   0x80000312
  513. #define IG_SDraw     0x80000313
  514. #define IG_SDrawAbs  0x80000314
  515. #define IG_SCurve    0x80000315
  516. #define IG_SCurveAbs 0x80000316
  517. #define IG_SEllipse  0x80000317
  518. #define IG_SAMove    0x80000321
  519. #define IG_SALocate  0x80000322
  520. #define IG_SADraw    0x80000323
  521. #define IG_SADrawAbs 0x80000324
  522. #define IG_SACurve   0x80000325
  523. #define IG_SACurveAbs 0x80000326
  524. #define IG_SAEllipse 0x80000327
  525. #define IG_SAEnd     0x8000033F
  526.  
  527. typedef ULONG IG_IntuiGfx;
  528. typedef IG_IntuiGfx *IG_IntuiGfxPtr;
  529.  
  530. /* Examples of using IntuiGfx stack programs:
  531.  *
  532.  *
  533.  *  Examples:
  534.  *
  535.  *    - Box3d       : Draw a rectangle in two colors.  To get a 3D effect
  536.  *                    the top and left line are colored different from the
  537.  *                    bottom and right line. (Same as IG_Box3d).
  538.  *                    Thus parameters are two colors, "bottomRight" and
  539.  *                    "topLeft", and the "width" and "height".
  540.  *
  541.  *                    Parameters:
  542.  *
  543.  *                       - bottomRight (FP+3) : Colour for left and top
  544.  *                       - topLeft     (FP+2) : Colour for right and bottom
  545.  *                       - width       (FP+1) : Width
  546.  *                       - height      (FP+0) : Height
  547.  *
  548.  
  549. ULONG Box3d[] = {
  550.   IG_ADDI-1,                            * decrease height by one            *
  551.   IG_SWAP,                              * swap width and height             *
  552.   IG_ADDI-1,                            * decrease width by one             *
  553.   IG_SWAP,                              * swap again                        *
  554.   IG_GETFI+2,IG_Color,                  * get and set color for             *
  555.                     * left and top                      *
  556.   IG_GETFI+1,IG_Const+0,IG_Draw,        * draw a line of width to the right *
  557.   IG_GETFI+3,IG_Color,                  * get and set color for             *
  558.                     * right and bottom                  *
  559.   IG_Const+0,IG_GETFI+0,IG_Draw,        * draw line of height to the bottom *
  560.   IG_GETFI+1,IG_NEG,IG_Const+0,IG_Draw, * draw line of negated              *
  561.                     * width to the right                *
  562.   IG_GETFI+2,IG_Color,                  * set color for top and left        *
  563.   IG_Const+0,IG_GETFI+0,IG_NEG,IG_Draw, * draw line of height to the top    *
  564.   IG_RTF+4                              * clear stack and return            *
  565. };
  566.  
  567.  *
  568.  *
  569.  *    - Border3d    : Draw a double-bordered 3D rectangle using the procedure
  570.  *                    "Box3d".  As it is unknown if the rectangle is to appear
  571.  *                    highlighted or pressed, again two colors must be
  572.  *                    specified.  The subroutine "Box3d" is called twice, once
  573.  *                    with the parameters of Border3d and once with exchanged
  574.  *                    colors and a smaller inner rectangle.
  575.  *
  576.  *                    Parameters:
  577.  *
  578.  *                       - dark        (FP+3) : First color
  579.  *                       - light       (FP+2) : Second color
  580.  *                       - width       (FP+1) : Width
  581.  *                       - height      (FP+0) : Height
  582.  *
  583.  
  584. ULONG Border3d[] = {
  585.   IG_GETFI+2,IG_GETFI+3,     * push colors reversed onto the stack         *
  586.   IG_GETFI+1,IG_ADDI-2,      * get width decreased by two so that the inner *
  587.                  * rectangle is created                         *
  588.   IG_GETFI+0,IG_ADDI-2,      * get height decreaed by two                   *
  589.   IG_Const+1,IG_DUP,IG_Move, * move cursor by one pixel to bottom and left  *
  590.   &Box3d,IG_JSR,             * call "Box3d" with modified parameters        *
  591.   IG_Locate00,               * reset cursor to top left corner              *
  592.   &Box3d,IG_JSR,             * call "Box3d" for outer rectangle with the    *
  593.                  * original parameters                          *
  594.   IG_RTS                     * return; no parameter deallocation as already *
  595.                  * performed by "Box3d" (dirty trick)           *
  596. };
  597.  
  598.  *
  599.  *    - Rect3d      : Draw a filled 3D rectangle.  This routine uses "Box3d"
  600.  *                    to draw a border around the rectangle.  Now a third
  601.  *                    color is needed, too, since the inner part of the
  602.  *                    rectangle is colored, either.
  603.  *
  604.  *                    Parameters:
  605.  *
  606.  *                       - inner       (FP+4) : Colour of inner part
  607.  *                       - bottomRight (FP+3) : Colour for bottom and right
  608.  *                       - leftTop     (FP+2) : Colour for top and left
  609.  *                       - width       (FP+1) : Width
  610.  *                       - height      (FP+0) : Height
  611.  *
  612.  
  613. ULONG Rect3d[] = {
  614.   IG_GETFI+4,IG_Color,           * set inner color                        *
  615.   IG_Const+1,IG_Const+1,IG_Move, * set inner cursor                       *
  616.   IG_GETFI+1,IG_ADDI-2,          * get width decreased by two for inner   *
  617.                  * rectangle                              *
  618.   IG_GETFI+0,IG_ADDI-2,          * get height decreased by two            *
  619.   IG_Box,                        * draw filled inner rect                 *
  620.   IG_Locate00,                   * back to the roots                      *
  621.   IG_DUPI+4,                     * get data for "Box3d". As the order is  *
  622.                  * the same, you could use the parameters *
  623.                  * already on the stack, but this is the  *
  624.                  * clean and neat solution.               *
  625.   &Box3d,IG_JSR,                 * call "Box3d"                           *
  626.   IG_RTF+5                       * return and clear stack                 *
  627. };
  628.  
  629.  *
  630.  *    - BigBorder3d : Draw a wide, filled 3D border.  The parameters are the
  631.  *                    same as for "Rect3d".
  632.  *
  633.  *                    Parameters:
  634.  *
  635.  *                       - inner       (FP+4) : Colour for inner border parts
  636.  *                       - bottomRight (FP+3) : Colour for bottom and right
  637.  *                       - leftTop     (FP+2) : Colour for top and left
  638.  *                       - width       (FP+1) : Width
  639.  *                       - height      (FP+0) : Height
  640.  *
  641.  
  642. ULONG BigBorder3d[] = {
  643.   IG_DUPI+4,&Box3d,IG_JSR,          * draw outer border *
  644.  
  645.   IG_GETFI+2,IG_GETFI+3,            * draw inner border *
  646.   IG_GETFI+1,IG_ADDI-30,
  647.   IG_GETFI+0,IG_ADDI-30,
  648.   IG_Const+15,IG_Const+15,IG_Move,
  649.   &Box3d,IG_JSR,
  650.  
  651.   IG_GETFI+4,IG_Color,              * set color for inner part *
  652.  
  653.   IG_Const+1,IG_Const+1,IG_Locate,  * draw top bar *
  654.   IG_GETFI+1,IG_ADDI-16,
  655.   IG_Const+14,IG_Box,
  656.  
  657.   IG_Const+0,IG_Const-14,IG_Move,   * draw right bar *
  658.   IG_Const+14,
  659.   IG_GETFI+0,IG_ADDI-16,IG_Box,
  660.  
  661.   IG_Const+1,IG_Const+15,IG_Locate, * draw left bar *
  662.   IG_Const+14,
  663.   IG_GETFI+0,IG_ADDI-16,IG_Box,
  664.  
  665.   IG_Const+0,IG_Const-14,IG_Move,   * draw bottom bar *
  666.   IG_GETFI+1,IG_ADDI-16,
  667.   IG_Const+14,IG_Box,
  668.  
  669.   IG_Locate00,                      * clean up *
  670.   IG_RTF+5
  671. };
  672.  *
  673.  *   - Write3d      : Write text with shadow effect.  For that the text is
  674.  *                    first written in a darker shade and slightly shifted,
  675.  *                    then the text is again written in a lighter color
  676.  *                    at the specified position.
  677.  *
  678.  *                    Parameters:
  679.  *
  680.  *                       - light       (FP+2) : Light color
  681.  *                       - shade       (FP+1) : Shadow color
  682.  *                       - text        (FP+0) : Text to be written (C string)
  683.  *
  684.  
  685. ULONG Write3d[] = {
  686.   IG_ModeA,                      * turn to "drawAPen"
  687.   IG_GETFI+1,IG_Color,           * set darker color
  688.   IG_Const+1,IG_Const+1,IG_Move, * altered position for shadowed text
  689.   IG_GETFI+0,IG_Text,            * write shadowed text
  690.   IG_Locate00,                   * back to the roots
  691.   IG_GETFI+2,IG_Color,           * set light color
  692.   IG_GETFI+0,IG_Text,            * write text
  693.   IG_RTF+3                       * clean up
  694. };
  695.  
  696. */
  697.  
  698. #endif /* EGS_EGSINTUIGFX_H */
  699.  
  700.